package com.mx.kn.cstf2.actions;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;

import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import kn.cstf2.cop.Bean.*;
import kn.cstf2.cop.Shared.CopShared;
import kn.cstf2.cop.Server.CopServer;
import kn.cstf2.global.Utils.ConexionFtp;
import kn.cstf2.global.Utils.CstF2Exception;
import kn.cstf2.implementation.Bean.ClienteStkBean;
import kn.cstf2.implementation.Bean.T_asignStkBean;
import kn.cstf2.implementation.Bean.TransitionsBeanImp;
import kn.cstf2.main.Shared.MainShared;
import kn.cstf2.transition.Bean.TransitionBean;
import kn.cstf2.transition.Shared.TransitionShared;

import com.mx.kn.cstf2.actions.padre.Cop;
import com.mx.kn.cstf2.actions.padre.Transition;
import com.mx.kn.cstf2.dto.ClientesSTKDto;
import com.mx.kn.cstf2.dto.CopAttachmentsDto;
import com.mx.kn.cstf2.dto.CopContactsDto;
import com.mx.kn.cstf2.dto.CopDto;
import com.mx.kn.cstf2.dto.CopWorkingInstructionsDto;
import com.mx.kn.cstf2.dto.CorreosBranchDto;
import com.mx.kn.cstf2.dto.CustomerSolutionDto;
import com.mx.kn.cstf2.dto.ExceptionCodeDto;
import com.mx.kn.cstf2.dto.HistoricoDto;
import com.mx.kn.cstf2.dto.KPIFieldsDto;
import com.mx.kn.cstf2.dto.UsuarioDto;
import com.mx.kn.cstf2.dts.FilesUploadDts;
import com.mx.kn.cstf2.service.CopService;
import com.mx.kn.cstf2.service.MailService;
import com.mx.kn.cstf2.service.TransitionService;
import com.mx.kn.cstf2.utils.AccionesHistorico;
import com.mx.kn.cstf2.utils.PlantillaNotifyStatus;
import com.mx.kn.cstf2.utils.TipoUsuarios;


@Component("copActionImportDefault")
@Scope(value="session")
public class CopActionImportDefault extends ActionSupport {

  
    public static final String ERROR_SESSION = "errorSession";
    public static final String ERROR_KNKEY = "errorKnkey";
    private String ERROR_DOWN = "errorFileTransition";
    public String ZIP = "zip";
    public String EXPORT = "export";
    private Boolean exportar;
    private String exporta;
    private TransitionBean transitionBeanM = new TransitionBean();
    private TransitionBean transitionBean;
    private Boolean gralVobo;
    private Boolean gralVoboSop;
    private ClienteStkBean financialBI = new ClienteStkBean();
    private String s1;
    private String delete;
    //private String fileNameUpload;
    private File fileNameUpload;
    ContactsBean contactsBean = null;
    private ArrayList<String> contactsList = new ArrayList<String>();
    private String requierementsTxt;
    private CopBean subproducts = new CopBean();
    private String originConditionsTxt;
    private String destinationConditionsTxt;
    private String workingInstructionsTxt;
    private String fileListOnServerSelected;
    private InputStream fileInputStream;
    private ArrayList<String> fileListOnServer = new ArrayList<String>();
    private ArrayList<String> creditTermsList = new ArrayList<String>();
    private ArrayList<String> billingCurrencyList = new ArrayList<String>();
    private ArrayList<String> invoiceRevDate = new ArrayList<String>();
    private ArrayList<String> invoiceReceDate = new ArrayList<String>();
    private ArrayList<String> fileAttachList = new ArrayList<String>();
    private ClienteStkBean cp = new ClienteStkBean();
    private ExceptionBean exceptionBean = new ExceptionBean();
    private KpiBean kpiBean = new KpiBean();
    private ArrayList<ContactsBean> detallesContactsList;
    private ArrayList<KpiBean> detalleSpecialList = new ArrayList<KpiBean>();
    private ArrayList<ExceptionBean> detallesExceptionList;
    private T_customer_solutionBeanSTK t_customer_solutionBeanSTK = new T_customer_solutionBeanSTK();
    private CustomerSolutionDto customerSolutionSTK = new CustomerSolutionDto();
    private CopBean copBeanJSP = new CopBean();
    private String submitFormMethod = new String();
    private Integer idImportExport;
    private String overviewhidden = new String();
    private String workingInst = new String();
    private String requirementsCop = new String();
    private String nombreArchivo = "";
    private String attach = "attachments";
    private int index = 0;
    private UsuarioDto usuario;
    private String nameFileDownload;
    
    
    private Cop cop;
    private String sbp;
    private boolean subFcl;
    private boolean subLcl;
    private boolean subPerishables;
    private boolean subBrokerage;
    private boolean subIntermodal;
    private boolean subInsurance;
   
    private List<CopDto> imports;
    private List<CopDto> exports;
    private List<CopContactsDto> contactsCop;
    private List<ExceptionCodeDto> exceptions;
    private List<CopAttachmentsDto> attachmentList;
    private CopDto form;
    
    private boolean fclScope;
    private boolean lclScope;
    private boolean perishablesScope;
    private boolean brokerageScope;
    private boolean intermodalScope;
    private boolean insuranceScope;
    private boolean oceanFreightScope;
    private boolean blueAnchorLineScope;
    private boolean seaTransportScope;
    private boolean exportCustomScope;
    private boolean inbondExpScope;
    private boolean importCustomScope;
    private boolean inbondImpScope;
    private boolean preCarrierScope;
    private boolean allMotorScope;
    private boolean combinedScope;
    private boolean onCarriageScope;
    
    private boolean pickUpToActDep;
    private boolean custClearToActDep;
    private boolean actDepToActArriv;
    private boolean actArrivToCustClear;
    private boolean actArrivToDelivery;
    
    //propiedades de contacts
    private String name;
    private String position;
    private String company;
    private String email;
    private String phone;
    private String ext;
    private String mobile;
    private int idContactDel;
    
    
    
    //propiedades Exception Codes
    private String exceptionCode;
    private String exceptionLogic;
    private String descriptionException;
    
    
    
    
//    variable contenedora de archivo
    private File upl;
    private String uplFileName;
    private InputStream inputStream;
    private List<KPIFieldsDto> camposKPI;
    private Integer idKPI;
    private int idDeleteFileCop;
    
    
    
    private ClientesSTKDto clientes;
    private String valueKPI;
    private Boolean checkBoxKPI;
    
    //Variable para working instructions
    private List<CopWorkingInstructionsDto> workingInstructionsFields;
    private Integer idWorkInst;
    private String valueWorkInst;
    
    @Autowired CopService copService;     
    @Autowired TransitionService transitionService;
    @Autowired MailService mailService;
    
	public boolean isPickUpToActDep() {
		return pickUpToActDep;
	}

	public void setPickUpToActDep(boolean pickUpToActDep) {
		this.pickUpToActDep = pickUpToActDep;
	}

	public boolean isCustClearToActDep() {
		return custClearToActDep;
	}

	public void setCustClearToActDep(boolean custClearToActDep) {
		this.custClearToActDep = custClearToActDep;
	}

	public boolean isActDepToActArriv() {
		return actDepToActArriv;
	}

	public void setActDepToActArriv(boolean actDepToActArriv) {
		this.actDepToActArriv = actDepToActArriv;
	}

	public boolean isActArrivToCustClear() {
		return actArrivToCustClear;
	}

	public void setActArrivToCustClear(boolean actArrivToCustClear) {
		this.actArrivToCustClear = actArrivToCustClear;
	}

	public boolean isActArrivToDelivery() {
		return actArrivToDelivery;
	}

	public void setActArrivToDelivery(boolean actArrivToDelivery) {
		this.actArrivToDelivery = actArrivToDelivery;
	}

	public Integer getIdWorkInst() {
		return idWorkInst;
	}

	public void setIdWorkInst(Integer idWorkInst) {
		this.idWorkInst = idWorkInst;
	}

	public String getValueWorkInst() {
		return valueWorkInst;
	}

	public void setValueWorkInst(String valueWorkInst) {
		this.valueWorkInst = valueWorkInst;
	}

	public List<CopWorkingInstructionsDto> getWorkingInstructionsFields() {
		return workingInstructionsFields;
	}

	public void setWorkingInstructionsFields(
			List<CopWorkingInstructionsDto> workingInstructionsFields) {
		this.workingInstructionsFields = workingInstructionsFields;
	}

	public Boolean getCheckBoxKPI() {
		return checkBoxKPI;
	}

	public void setCheckBoxKPI(Boolean checkBoxKPI) {
		this.checkBoxKPI = checkBoxKPI;
	}

	public String getValueKPI() {
		return valueKPI;
	}

	public void setValueKPI(String valueKPI) {
		this.valueKPI = valueKPI;
	}

	public Integer getIdKPI() {
		return idKPI;
	}

	public void setIdKPI(Integer idKPI) {
		this.idKPI = idKPI;
	}

	public List<KPIFieldsDto> getCamposKPI() {
		return camposKPI;
	}

	public void setCamposKPI(List<KPIFieldsDto> camposKPI) {
		this.camposKPI = camposKPI;
	}

	public String getRequirementsCop() {
		return requirementsCop;
	}

	public void setRequirementsCop(String requerimentsCop) {
		this.requirementsCop = requerimentsCop;
	}

	public CustomerSolutionDto getCustomerSolutionSTK() {
		return customerSolutionSTK;
	}

	public void setCustomerSolutionSTK(CustomerSolutionDto customerSolutionSTK) {
		this.customerSolutionSTK = customerSolutionSTK;
	}

	public ClientesSTKDto getClientes() {
		return clientes;
	}

	public void setClientes(ClientesSTKDto clientes) {
		this.clientes = clientes;
	}

	public String getWorkingInst() {
		return workingInst;
	}

	public void setWorkingInst(String workingInst) {
		this.workingInst = workingInst;
	}

	public boolean isBlueAnchorLineScope() {
		return blueAnchorLineScope;
	}

	public void setBlueAnchorLineScope(boolean blueAnchorLineScope) {
		this.blueAnchorLineScope = blueAnchorLineScope;
	}

	public CopDto getForm() {
		return form;
	}

	public void setForm(CopDto form) {
		this.form = form;
	}

	public boolean isOceanFreightScope() {
		return oceanFreightScope;
	}

	public void setOceanFreightScope(boolean oceanFreightScope) {
		this.oceanFreightScope = oceanFreightScope;
	}

	public boolean isBlueAnchoLineScope() {
		return blueAnchorLineScope;
	}

	public void setBlueAnchoLineScope(boolean blueAnchorLineScope) {
		this.blueAnchorLineScope = blueAnchorLineScope;
	}

	public boolean isSeaTransportScope() {
		return seaTransportScope;
	}

	public void setSeaTransportScope(boolean seaTransportScope) {
		this.seaTransportScope = seaTransportScope;
	}

	public boolean isExportCustomScope() {
		return exportCustomScope;
	}

	public void setExportCustomScope(boolean exportCustomScope) {
		this.exportCustomScope = exportCustomScope;
	}

	public boolean isInbondExpScope() {
		return inbondExpScope;
	}

	public void setInbondExpScope(boolean inbondExpScope) {
		this.inbondExpScope = inbondExpScope;
	}

	public boolean isImportCustomScope() {
		return importCustomScope;
	}

	public void setImportCustomScope(boolean importCustomScope) {
		this.importCustomScope = importCustomScope;
	}

	public boolean isInbondImpScope() {
		return inbondImpScope;
	}

	public void setInbondImpScope(boolean inbondImpScope) {
		this.inbondImpScope = inbondImpScope;
	}

	public boolean isPreCarrierScope() {
		return preCarrierScope;
	}

	public void setPreCarrierScope(boolean preCarrierScope) {
		this.preCarrierScope = preCarrierScope;
	}

	public boolean isAllMotorScope() {
		return allMotorScope;
	}

	public void setAllMotorScope(boolean allMotorScope) {
		this.allMotorScope = allMotorScope;
	}

	public boolean isCombinedScope() {
		return combinedScope;
	}

	public void setCombinedScope(boolean combinedScope) {
		this.combinedScope = combinedScope;
	}

	public boolean isOnCarriageScope() {
		return onCarriageScope;
	}

	public void setOnCarriageScope(boolean onCarriageScope) {
		this.onCarriageScope = onCarriageScope;
	}

	public boolean isFclScope() {
		return fclScope;
	}

	public void setFclScope(boolean fclScope) {
		this.fclScope = fclScope;
	}

	public boolean isLclScope() {
		return lclScope;
	}

	public void setLclScope(boolean lclScope) {
		this.lclScope = lclScope;
	}

	public boolean isPerishablesScope() {
		return perishablesScope;
	}

	public void setPerishablesScope(boolean perishablesScope) {
		this.perishablesScope = perishablesScope;
	}

	public boolean isBrokerageScope() {
		return brokerageScope;
	}

	public void setBrokerageScope(boolean brokerageScope) {
		this.brokerageScope = brokerageScope;
	}

	public boolean isIntermodalScope() {
		return intermodalScope;
	}

	public void setIntermodalScope(boolean intermodalScope) {
		this.intermodalScope = intermodalScope;
	}

	public boolean isInsuranceScope() {
		return insuranceScope;
	}

	public void setInsuranceScope(boolean insuranceScope) {
		this.insuranceScope = insuranceScope;
	}

	public String getNombreArchivo() {
        return nombreArchivo;
    }

    public void setNombreArchivo(String nombreArchivo) {
        this.nombreArchivo = nombreArchivo;
    }

    public String getOverviewhidden() {
        return overviewhidden;
    }

    public void setOverviewhidden(String overviewhidden) {
        this.overviewhidden = overviewhidden;
    }

    public String getSubmitFormMethod() {
        return submitFormMethod;
    }

    public void setSubmitFormMethod(String submitFormMethod) {
        this.submitFormMethod = submitFormMethod;
    }

    public Boolean getExportar() {
        return exportar;
    }

    public void setExportar(Boolean exportar) {
        this.exportar = exportar;
    }

    public CopBean getCopBeanJSP() {
        return copBeanJSP;
    }

    public void setCopBeanJSP(CopBean copBeanJSP) {
        this.copBeanJSP = copBeanJSP;
    }

    public T_customer_solutionBeanSTK getT_customer_solutionBeanSTK() {
        return t_customer_solutionBeanSTK;
    }

    public void setT_customer_solutionBeanSTK(T_customer_solutionBeanSTK t_customer_solutionBeanSTK) {
        this.t_customer_solutionBeanSTK = t_customer_solutionBeanSTK;
    }

    public KpiBean getKpiBean() {
        return kpiBean;
    }

    public void setKpiBean(KpiBean kpiBean) {
        this.kpiBean = kpiBean;
    }

    public ExceptionBean getExceptionBean() {
        return exceptionBean;
    }

    public void setExceptionBean(ExceptionBean exceptionBean) {
        this.exceptionBean = exceptionBean;
    }

    public ArrayList<ExceptionBean> getDetallesExceptionList() {
        return detallesExceptionList;
    }

    public void setDetallesExceptionList(ArrayList<ExceptionBean> detallesExceptionList) {
        this.detallesExceptionList = detallesExceptionList;
    }

    public ArrayList<KpiBean> getDetalleSpecialList() {
        return detalleSpecialList;
    }

    public void setDetalleSpecialList(ArrayList<KpiBean> detalleSpecialList) {
        this.detalleSpecialList = detalleSpecialList;
    }

    public ArrayList<String> getFileAttachList() {
        return fileAttachList;
    }

    public void setFileAttachList(ArrayList<String> fileAttachList) {
        this.fileAttachList = fileAttachList;
    }

    public String getS1() {
        return s1;
    }

    public void setS1(String s1) {
        this.s1 = s1;
    }

    public String getDelete() {
        return delete;
    }

    public void setDelete(String delete) {
        this.delete = delete;
    }

    public File getFileNameUpload() {
        return fileNameUpload;
    }

    public void setFileNameUpload(File fileNameUpload) {
        this.fileNameUpload = fileNameUpload;
    }

    public ClienteStkBean getFinancialBI() {
        return financialBI;
    }

    public void setFinancialBI(ClienteStkBean financialBI) {
        this.financialBI = financialBI;
    }

    public ArrayList<ContactsBean> getDetallesContactsList() {
        return detallesContactsList;
    }

    public void setDetallesContactsList(ArrayList<ContactsBean> detallesContactsList) {
        this.detallesContactsList = detallesContactsList;
    }

    public ClienteStkBean getCp() {
        return cp;
    }

    public void setCp(ClienteStkBean cp) {
        this.cp = cp;
    }

    public InputStream getFileInputStream() {
        return fileInputStream;
    }

    public void setFileInputStream(InputStream fileInputStream) {
        this.fileInputStream = fileInputStream;
    }

    public String getFileListOnServerSelected() {
        return fileListOnServerSelected;
    }

    public void setFileListOnServerSelected(String fileListOnServerSelected) {
        this.fileListOnServerSelected = fileListOnServerSelected;
    }

    public ArrayList<String> getBillingCurrencyList() {
        return billingCurrencyList;
    }

    public void setBillingCurrencyList(ArrayList<String> billingCurrencyList) {
        this.billingCurrencyList = billingCurrencyList;
    }

    public ArrayList<String> getCreditTermsList() {
        return creditTermsList;
    }

    public void setCreditTermsList(ArrayList<String> creditTermsList) {
        this.creditTermsList = creditTermsList;
    }

    public ArrayList<String> getInvoiceReceDate() {
        return invoiceReceDate;
    }

    public void setInvoiceReceDate(ArrayList<String> invoiceReceDate) {
        this.invoiceReceDate = invoiceReceDate;
    }

    public ArrayList<String> getInvoiceRevDate() {
        return invoiceRevDate;
    }

    public void setInvoiceRevDate(ArrayList<String> invoiceRevDate) {
        this.invoiceRevDate = invoiceRevDate;
    }

    public ArrayList<String> getFileListOnServer() {
        return fileListOnServer;
    }

    public void setFileListOnServer(ArrayList<String> fileListOnServer) {
        this.fileListOnServer = fileListOnServer;
    }

    public String getWorkingInstructionsTxt() {
        return workingInstructionsTxt;
    }

    public void setWorkingInstructionsTxt(String workingInstructionsTxt) {
        this.workingInstructionsTxt = workingInstructionsTxt;
    }

    public String getDestinationConditionsTxt() {
        return destinationConditionsTxt;
    }

    public void setDestinationConditionsTxt(String destinationConditionsTxt) {
        this.destinationConditionsTxt = destinationConditionsTxt;
    }

    public String getOriginConditionsTxt() {
        return originConditionsTxt;
    }

    public void setOriginConditionsTxt(String originConditionsTxt) {
        this.originConditionsTxt = originConditionsTxt;
    }

    public CopBean getSubproducts() {
        return subproducts;
    }

    public void setSubproducts(CopBean subproducts) {
        this.subproducts = subproducts;
    }

    public String getRequierementsTxt() {
        return requierementsTxt;
    }

    public void setRequierementsTxt(String requierementsTxt) {
        this.requierementsTxt = requierementsTxt;
    }

    public ArrayList<String> getContactsList() {
        return contactsList;
    }

    public void setContactsList(ArrayList<String> contactsList) {
        this.contactsList = contactsList;
    }

    public ContactsBean getContactsBean() {
        return contactsBean;
    }

    public void setContactsBean(ContactsBean contactsBean) {
        this.contactsBean = contactsBean;
    }

    public String getExporta() {
        return exporta;
    }

    public void setExporta(String exporta) {
        this.exporta = exporta;
    }

    public TransitionBean getTransitionBean() {
        return transitionBean;
    }

    public void setTransitionBean(TransitionBean transitionBean) {
        this.transitionBean = transitionBean;
    }

    public TransitionBean getTransitionBeanM() {
        return transitionBeanM;
    }

    public void setTransitionBeanM(TransitionBean transitionBeanM) {
        this.transitionBeanM = transitionBeanM;
    }
    private ArrayList<TransitionBean> transitionBeanArray;

    public ArrayList<TransitionBean> getTransitionBeanArray() {
        return transitionBeanArray;
    }

    public void setTransitionBeanArray(ArrayList<TransitionBean> transitionBeanArray) {
        this.transitionBeanArray = transitionBeanArray;
    }

    public String execute() {
       try {
    	 ActionContext contexto = ActionContext.getContext();
    	 Map<String, Object> sesion = contexto.getSession();
         this.setUsuario((UsuarioDto) sesion.get("usuarioSession"));
         
         switch (this.getUsuario().getTipo()) {
			case TipoUsuarios.USER_FS:
				cop = new CopFS();
			 break;
			
				
			case TipoUsuarios.USER_FO:
				cop = new CopFO();

			case TipoUsuarios.USER_FA:
				cop = new CopFA();
			default:
				break;
			}
    	
         
         transitionBean = new TransitionBean();
       //el Objeto implementation contiene un Objeto transition el cual contiene los atributos de la transition
         cop.setTransition((Transition) sesion.get("transition"));
            
         if(cop.getTransition() instanceof TransitionFS){
         	cop.setTransition((TransitionFS) sesion.get("transition"));
         }else if(cop.getTransition() instanceof TransitionFO){
         	cop.setTransition((TransitionFO) sesion.get("transition"));
         }else if(cop.getTransition() instanceof TransitionFA){
         	cop.setTransition((TransitionFA) sesion.get("transition"));
         }
         
         

        if (cop.getTransition().getTransitionBeanM().getKnkey() == null) {
            CstF2Exception ex = new CstF2Exception();
            
            addFieldError("Not Knkey Found", "PorFavor Seleccione una Knkey: " + ex.getMessage());
            MainShared mainShared = new MainShared();
            setTransitionBeanArray(mainShared.GetTransitionBeanArrayIdKnkey(usuario));

            return ERROR_KNKEY;
        }

        String sbm = getSubmitFormMethod();
        if (sbm.equals("SaveInfoUser05")) {
            saveInfoUser05();
        }
       
            contactsList.add("SU");
            contactsList.add("RU");
            contactsList.add("Guest");
            
            clientes = copService.getClientInfo(cop.getTransition().getTransitionBeanM().getKnkey());
            clientes.setAccounts_visibility(copService.getBillingInstructions(cop.getTransition().getTransitionBeanM().getKnkey()));
            customerSolutionSTK = copService.getReports(cop.getTransition().getTransitionBeanM().getKnkey());

//            CopShared copShared = new CopShared();
//            ClienteStkBean clienteStkBean = new ClienteStkBean();
//            TransitionShared transitionShared = new TransitionShared();
//
//            cp = copShared.GetAllDataFromClientesSTK(cop.getTransition().getTransitionBeanM().getKnkey());
//            clienteStkBean = copShared.GetAcountVisibilitySTK(cop.getTransition().getTransitionBeanM().getKnkey());
//            cp.setAccounts_visibility(clienteStkBean.getAccounts_visibility());
//
//            t_customer_solutionBeanSTK = copShared.GetCustomerSolutionStk(cop.getTransition().getTransitionBeanM().getKnkey());
//
//            financialBI = copShared.GetAllDataFromClientesSTK(cop.getTransition().getTransitionBeanM().getKnkey());
//
//            TransitionBean transitionBeanNew = new TransitionBean();
//
//            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(cop.getTransition().getTransitionBeanM());
//            transitionBeanM = transitionBeanNew;
//
//            subproducts = copShared.GetDataFromCop(cop.getTransition().getTransitionBeanM().getId(), exportar);
//
//            detalleSpecialList = copShared.GetKpiSTK(subproducts.getId());
//            detallesExceptionList = copShared.GetExceptionListSTK(subproducts.getId());
//
//            copBeanJSP = copShared.GetDataFromCop(cop.getTransition().getTransitionBeanM().getId(), exportar);
//
//            
//            detallesContactsList = copShared.getContactList(subproducts.getId());

        } catch (CstF2Exception ex) {
            
//            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        } catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NullPointerException et){
			
		}
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }
    
    public String getOverview(){
    	return SUCCESS;
    }
    
    public String getScopeService(){
    	return SUCCESS;
    }
    
    public String getContacts() {
    	CopDto copDto = new CopDto();
    	copDto.setId(idImportExport);
    	try {
    		contactsCop = copService.getContactsList(copDto);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	return SUCCESS;
    }
    
    public String getCopWorkingInstructions(){
    	return SUCCESS;
    }
    
    public String getCopBillingInstructions(){
    	return SUCCESS;
    }
    
    public String updateKPI(){
    	
    	KPIFieldsDto updateKPI = new KPIFieldsDto();
    	
    	updateKPI.setId(getIdKPI());
    	updateKPI.setFieldValue(getValueKPI());   	
    	try{
    		copService.updateKPIFields(updateKPI);
    		getKPIFields();
    	} catch (SQLException e){
    		e.printStackTrace();
    	}
    	
    	return SUCCESS;
    }
    
public String updateKPICheckBox(){
    	
    	KPIFieldsDto updateKPI = new KPIFieldsDto();
    	
    	updateKPI.setId(getIdKPI());
    	updateKPI.setChecked(getCheckBoxKPI());    	
    	try{
    		copService.updateKPIChecks(updateKPI);
    		getKPIFields();
    	} catch (SQLException e){
    		e.printStackTrace();
    	}
    	
    	return SUCCESS;
    }

public String addKPI(){
	
	KPIFieldsDto updateKPI = new KPIFieldsDto();
	
	updateKPI.setIdCop(getIdImportExport());   	
	try{
		copService.insertKPI(updateKPI);
		transitionService.insertHistorico(new HistoricoDto(this.getUsuario().getId(), new Date(),"Se agrego nuevo KPI ", AccionesHistorico.AGREGAR_KPI));
		getKPIFields();
	} catch (SQLException e){
		e.printStackTrace();
	}
	
	return SUCCESS;
}
    
    public String getExceptionCodes(){
    	ExceptionCodeDto exception = new ExceptionCodeDto();
    	exception.setIdCop(idImportExport);
    	try {
    		exceptions = copService.getExceptionsByIdCop(exception);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
    	return SUCCESS;
        }
    
    public String getRequirements(){
    	return SUCCESS;
    }
    
    public String getReports(){
    	return SUCCESS;
    }
    
    public String getAttachments(){
    	return SUCCESS;
    }
    
    public String getKpiSpecial(){
    	return SUCCESS;
    }
    
    public String getImportsList(){
    	try {
			imports = copService.getImports(cop.getTransition().getTransitionBeanM());
		} catch (SQLException e) {
			e.printStackTrace();
		} catch(NullPointerException ex){
			return SUCCESS;
		}
    	return SUCCESS;
    }
    
    public String getExportList(){
    	try {
			exports = copService.getExports(cop.getTransition().getTransitionBeanM());
		} catch (SQLException e) {
			e.printStackTrace();
		} catch(NullPointerException ex){
			return SUCCESS;
		}
    	return SUCCESS;
    }
    
    public String getKPIFields(){
    	try{
    		camposKPI = copService.getKPIFields(idImportExport);
    	}catch(SQLException e){
    		e.printStackTrace();
    	}
    	return SUCCESS;
    }
    
//    private void clienteGrid() throws SQLException{
//		boolean validaClientes = transitionService.validaExistenciaCliente(this.getUsuario().getId(), transitionBean.getId());
//		if(!validaClientes)
//			transitionService.InsertaClienteGrid(this.getUsuario().getId(), transitionBean.getId());
//	}
    
    public String addImport(){
    	
    	Date fecha = new Date();
    	
    	try {
			copService.addImport(cop.getTransition().getTransitionBeanM(), usuario, fecha);
//			clienteGrid();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
    	return SUCCESS;
    }
    
    public String addExport(){
    	
    	Date fecha = new Date();
    	
    	try {
			copService.addExport(cop.getTransition().getTransitionBeanM(), usuario, fecha);
//			clienteGrid();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
    	return SUCCESS;
    }

    public String actualizarpagina(Boolean exportar) {

        try {
            contactsList.add("SU");
            contactsList.add("RU");
            contactsList.add("Guest");

            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            CopShared copShared = new CopShared();
            ClienteStkBean clienteStkBean = new ClienteStkBean();
            TransitionShared transitionShared = new TransitionShared();

            cp = copShared.GetAllDataFromClientesSTK(transitionBeanM.getKnkey());
            clienteStkBean = copShared.GetAcountVisibilitySTK(transitionBeanM.getKnkey());
            cp.setAccounts_visibility(clienteStkBean.getAccounts_visibility());

            t_customer_solutionBeanSTK = copShared.GetCustomerSolutionStk(transitionBeanM.getKnkey());

            financialBI = copShared.GetAllDataFromClientesSTK(transitionBeanM.getKnkey());

            TransitionBean transitionBeanNew = new TransitionBean();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            subproducts = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);

            detalleSpecialList = copShared.GetKpiSTK(subproducts.getId());
            detallesExceptionList = copShared.GetExceptionListSTK(subproducts.getId());

            copBeanJSP = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);

            ConexionFtp conexionFtp = new ConexionFtp(attach);
            fileListOnServer = conexionFtp.enlistaDir(transitionBeanM.getKnkey());
            
            detallesContactsList = copShared.getContactList(copBeanJSP.getId());

        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String GetAllDataFroSTK() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            CopShared copShared = new CopShared();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            clienteStkBean = copShared.GetAllDataFromClientesSTK(transitionBeanM.getKnkey());

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String ExportCop() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            CopBean copBean = new CopBean();
            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);
            if (copBean.getId() == null) {
                copShared.InsertDefaultValuesEnCop(true, transitionBeanM.getId());
            }

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String removeContact() {
        UsuarioDto usuario = new UsuarioDto();
        ActionContext contexto = ActionContext.getContext();
        Map<String, Object> sesion = contexto.getSession();
        usuario = (UsuarioDto) sesion.get("usuarioSession");
        Map<String, Object> sesion2 = contexto.getSession();
        transitionBeanM = (TransitionBean) sesion2.get("Knkey");

        contactsList.add("SU");
        contactsList.add("GUEST");
        contactsList.add("RU");

        TransitionShared transitionShared = new TransitionShared();
        CopShared copShared = new CopShared();
        CopBean copBean = new CopBean();

        TransitionBean transitionBeanNew = new TransitionBean();
        transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
        transitionBeanM = transitionBeanNew;

        copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);

        detallesContactsList = copShared.getContactList(copBean.getId());
        copShared.removeContacto(detallesContactsList.get(getIndex()).getId());
        Map<String, Object> sesionListP = contexto.getSession();
        sesionListP.put("ListaContacts", detallesContactsList);
        
        actualizarpagina(exportar);
        
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String AssingContactC03False() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            contactsList.add("SU");
            contactsList.add("GUEST");
            contactsList.add("RU");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);
            contactsBean.setIdcop(copBean.getId());

            copShared.InsertIntoContats(contactsBean);  //lo q hay desde el jsp

            Map<String, Object> sesionListP = contexto.getSession();
            detallesContactsList = (ArrayList<ContactsBean>) sesionListP.get("ListaContacts");

            if (detallesContactsList == null) {
                detallesContactsList = new ArrayList<ContactsBean>();

                detallesContactsList.add(contactsBean);

            } else {
                detallesContactsList.add(contactsBean);
            }
            sesionListP.put("ListaContacts", detallesContactsList);

            transitionBeanM.setTime(copShared.GetTheDateTime());
            transitionBeanM.setContacts(true);

            TransitionsBeanImp tbdate2 = new TransitionsBeanImp();
            Date date = new Date();
            DateFormat dateFormatCQL = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            String fecha = dateFormatCQL.format(date);

            transitionBeanM.setContactsdate(fecha);

            copShared.UpdateContactsyContacsDateIntoTransitions(transitionBeanM);

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String DeletePersonAsContac04tFalse() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");


            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);

            ContactsBean contactsBeanId = new ContactsBean();
            contactsBeanId = copShared.GetDatosDeContacts(copBean.getId());

            copShared.DeleteContacto(contactsBeanId.getIdcop());

            copShared.ContarContactosEnTransitions(transitionBeanM.getId());

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }
    
    public String saveCop(){
    	CopDto form = new CopDto();
    	try{
    		form.setId(idImportExport);
    		form.setOverview(overviewhidden);
    		form.setFcl(fclScope);
    		form.setLcl(lclScope);
    		form.setPerishables(perishablesScope);
    		form.setBrokerage(brokerageScope);
    		form.setIntermodal(intermodalScope);
    		form.setInsurance(insuranceScope);
    		form.setOceanFreight(oceanFreightScope);
    		form.setBlueAnchorLine(blueAnchorLineScope);
    		form.setSeaTransport(seaTransportScope);
    		form.setExportCustom(exportCustomScope);
    		form.setInbondExp(inbondExpScope);
    		form.setImportCustom(importCustomScope);
    		form.setInbondImp(inbondImpScope);
    		form.setPreCarrier(preCarrierScope);
    		form.setAllMotor(allMotorScope);
    		form.setCombined(combinedScope);
    		form.setOnCarriage(onCarriageScope);
//    		form.setWorkInst(workingInst);
    		form.setPickUpToActDep(pickUpToActDep);
    		form.setCustomClearToActDep(custClearToActDep);
    		form.setActDepToActArriv(actDepToActArriv);
    		form.setActArrivToCustomClear(actArrivToCustClear);
    		form.setActArrivToDelivery(actArrivToDelivery);
    		form.setRequirements(requirementsCop);
    		copService.updateCop(form);
    		
    		transitionService.insertHistorico(new HistoricoDto(this.getUsuario().getId(), new Date(),"Guardado cop" , AccionesHistorico.GUARDADO_COP));
    	}catch(Exception ex){
    		
    	}
    	return SUCCESS;
    }
    
    public String getformulario(){
    	try{    		
    		form = copService.getForm(idImportExport);
    		workingInstructionsFields = copService.getWorkInstFields(this.getUsuario().getTipo(), this.getIdImportExport());
//    		Integer.parseInt(idImportExport)
    		System.out.println();
    	}
    	catch(Exception ex){
    		
    	}
    	return SUCCESS;
    }
    
    public String insertWIFields(){
    	
    	List<CopWorkingInstructionsDto> listaCampos = new ArrayList<CopWorkingInstructionsDto>(); //Estos campos se van a insertar a la segunda tabla
    	try {
    		
    		listaCampos = copService.getWorkInstFieldsSecCase(this.getUsuario().getTipo());
    		
    		if(!copService.validaExistenciaCop(getIdImportExport())){
    			for(CopWorkingInstructionsDto campos : listaCampos){
    				copService.insertWorkInstFields(campos.getId(), getIdImportExport());
    			}  			
    		}
    		workingInstructionsFields = copService.getWorkInstFields(this.getUsuario().getTipo(), this.getIdImportExport());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}   	
    	return SUCCESS;
    }
    
    public String updateWIFields(){
    	try{
//    		if(copService.validaExistenciaCop(getIdImportExport(), getIdWorkInst()))
    			copService.updateWorkInstFields(getIdWorkInst(), getValueWorkInst(), getIdImportExport());
//    		else
//    			copService.insertWorkInstFields(getIdWorkInst(), getValueWorkInst(), getIdImportExport());
    		
    		workingInstructionsFields = copService.getWorkInstFields(this.getUsuario().getTipo(), this.getIdImportExport());
    	}catch(Exception ex){
    		
    	}
    	return SUCCESS;
    }

    public String saveInfoUser05() {

        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();

            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

           
           
           
            if (sbp.length() > 4) {
                
            	
            	transitionBean.setReporting(true);
            	transitionBean.setId(cop.getTransition().getTransitionBeanM().getId());
            	transitionBean.setTipoTransition(cop.getTransition().getTransitionBeanM().getTipoTransition());
                Date date = new Date();
                DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
                String fecha = dateFormat.format(date);
                transitionBean.setReportingdate(fecha);
                try {
					transitionBean = copService.updateReportingTransition(transitionBean);
					System.out.println();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
              
            }

            
            
            if (subproducts.getFcl() == true || subproducts.getLcl() == true || subproducts.getPerishables() == true || subproducts.getBrokerage() == true || subproducts.getIntermodal() == true || subproducts.getInsurance() == true) {
            	transitionBean.setScopeofservice(true);
            	transitionBean.setId(cop.getTransition().getTransitionBeanM().getId());
            	transitionBean.setTipoTransition(cop.getTransition().getTransitionBeanM().getTipoTransition());
                Date datesos = new Date();
                DateFormat dateFormatsos = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
                String fechasos = dateFormatsos.format(datesos);
                transitionBean.setScopeofservicedate(fechasos);

                try {
					transitionBean = copService.updateScopeOfServiceTransition(transitionBean);
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
                	
            }
//
//            String oc = subproducts.getOriginconditions();
//            String dc = subproducts.getDestconditions();
//            if (oc.length() > 4 || dc.length() > 4) {
//                transitionsBeanCop.setCondition(true);
//                transitionsBeanCop.setId(transitionBeanM.getId());
//                Date dateOrc = new Date();
//                DateFormat dateFormatOrc = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
//                String fechaOrc = dateFormatOrc.format(dateOrc);
//                transitionsBeanCop.setConditionsdate(fechaOrc);
//
//                copShared.UpdateConditionTransition(transitionsBeanCop);
//            }
//
//            String wi = subproducts.getWorkinst();
//            if (wi.length() > 4) {
//                transitionsBeanCop.setWorkingst(true);
//                transitionsBeanCop.setId(transitionBeanM.getId());
//                Date dateWrk = new Date();
//                DateFormat dateFormatWrk = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
//                String fechaWrk = dateFormatWrk.format(dateWrk);
//                transitionsBeanCop.setWorkingstdate(fechaWrk);
//
//                copShared.UpdateWorkingSTTransition(transitionsBeanCop);
//            }
//
//
//
//            if (subproducts.getPickuptosiling() == true || subproducts.getCustomsclearance() == true || subproducts.getMaincarriage() == true || subproducts.getArrivaltocustoms() == true || subproducts.getArrivaltodelivery()) {
//                transitionsBeanCop.setKpi(true);
//                transitionsBeanCop.setId(transitionBeanM.getId());
//                Date dateKpi = new Date();
//                DateFormat dateFormatKpi = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
//                String fechaKpi = dateFormatKpi.format(dateKpi);
//                transitionsBeanCop.setKpidate(fechaKpi);
//
//                copShared.UpdateKpiTransition(transitionsBeanCop);
//            }
//
//            if (financialBI != null) {
//                transitionsBeanCop.setBilling(true);
//                transitionsBeanCop.setId(transitionBeanM.getId());
//                Date dateBil = new Date();
//                DateFormat dateFormatBil = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
//                String fechaBil = dateFormatBil.format(dateBil);
//                transitionsBeanCop.setBillingdate(fechaBil);
//
//                copShared.UpdateBillingTransition(transitionsBeanCop);
//            }
//      
//
//            if (detallesContactsList != null) {
//                transitionsBeanCop.setContacts(true);
//                transitionsBeanCop.setId(transitionBeanM.getId());
//                Date dateCon = new Date();
//                DateFormat dateFormatCon = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
//                String fechaCon = dateFormatCon.format(dateCon);
//                transitionsBeanCop.setContactsdate(fechaCon);
//
//                copShared.UpdateContactsTransition(transitionsBeanCop);
//            }
//
//
//            //traer primero los datos de cop para despues hacerlees update sin perder los datos enviados desde el jsp
//            //valido si tienes propiedades nulas
//            CopBean copBean = new CopBean();
//            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);
//            subproducts = copShared.validarsihaynull(subproducts, copBean);
//            copShared.UpdateCop(subproducts);
//
//            transitionsBeanCop = copShared.SelectAllDataFromTransition(transitionBeanM.getId());
//            copShared.UpdateTransition(transitionsBeanCop);
//
//            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

//    public String UploadtxtLogAlert06(){
//      try{
//        UsuarioDto usuario = new UsuarioDto();
//        ActionContext contexto = ActionContext.getContext();
//        Map<String, Object> sesion = contexto.getSession();
//        usuario=(UsuarioDto)sesion.get("usuarioSession");
//        Map<String, Object> sesion2 = contexto.getSession();
//        transitionBeanM=(TransitionBean) sesion2.get("Knkey");
//        
//        TransitionShared transitionShared = new TransitionShared();
//        CopShared copShared = new CopShared();
//        CopBean copBean = new CopBean();
//        ClienteStkBean clienteStkBean = new ClienteStkBean();
//        
//        TransitionBean transitionBeanNew=new TransitionBean();
//        transitionBeanNew=transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
//        transitionBeanM = transitionBeanNew;
//   
//        String nombree="";
//        for(int i=0; i< getNombreArchivo().length(); i++){
//            if(String.valueOf( getNombreArchivo().charAt(i)).equalsIgnoreCase(".")){
//                nombree+="_"+transitionBeanNew.getKnkey()+String.valueOf( getNombreArchivo().charAt(i));
//            }else{
//            nombree+=String.valueOf(getNombreArchivo().charAt(i));
//            }
//        }
//   
// 
//        ConexionFtp conexionFtp = new ConexionFtp();
//        File name=getFileNameUpload(); 
// 
//       
//        nombree = name.getParent()+"\\"+nombree;
//        String nombrepath="";
//        
//        for(int i=0; i< nombree.length(); i++){
//            if(i==nombree.length()-1){
//            }else{
//            nombrepath+=String.valueOf(nombree.charAt(i));
//            }
//        }
//       
//        setS1("c:\\consultas.rar");
//        //File firstLocalFile = new File("c:/consultas.rar");
//        File firstLocalFile = new File(name.getParent());
//       
//        
//       
// 
//            
//            String nombre = firstLocalFile.getName();
//            FileInputStream inputStream = new FileInputStream(firstLocalFile);
//            //FileInputStream inputStream = new FileInputStream(firstLocalFile);
//    
//            System.out.println("Start uploading first file");
//            boolean done = conexionFtp.guarda(nombre, inputStream);
//            
//            fileListOnServer = conexionFtp.enlistaDir();
//            
//            inputStream.close();
//            if (done) {
//                System.out.println("The first file is uploaded successfully.");
//            }
//         actualizarpagina(exportar);
//        }catch (CstF2Exception ex) {
//            
//            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
//            return ERROR_SESSION;
//        }
//        catch (Exception ex) {
//            
//            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
//            return ERROR_SESSION;
//        }
//        if(exportar==false){
//        return SUCCESS;}else{return EXPORT;}
//    }
    
    public String downloadFileAction() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            ConexionFtp conexionFtp = new ConexionFtp(attach);
            fileInputStream = conexionFtp.obtenInfo(getFileListOnServerSelected());
            fileListOnServer = conexionFtp.getNombresArchivos();


        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        } catch (Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        return ZIP;
    }

    public String deleteFileAction() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;


            ConexionFtp conexionFtp = new ConexionFtp(attach);

            conexionFtp.borra(getFileListOnServerSelected(), "attachments");

            fileListOnServer = conexionFtp.enlistaDir(transitionBeanM.getKnkey());
            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        } catch (Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String AssingExceptionFalse() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);
            copShared.InsertExceptionSTK(exceptionBean, copBean.getId());

            actualizarpagina(exportar);

        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        } catch (Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String AssingKpiFalse() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);
            copShared.InsertKpisSTK(kpiBean, copBean.getId());

            actualizarpagina(exportar);

        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        } catch (Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String GetDataClientFromSTK() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            clienteStkBean = copShared.GetAllDataFromClientesSTK(transitionBeanM.getKnkey());

            T_asignStkBean t_asignStkBean = new T_asignStkBean();
            t_asignStkBean = copShared.GetIfOwnerFromSTK(transitionBeanM.getKnkey());

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String GetInputInfoFromCop() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;


            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);

//         Boolean exporta1=false;
//         copShared.InsertDefaultValuesEnCop(false, transitionBeanM.getId());
//         
//         Boolean exporta2=true;
            copShared.InsertDefaultValuesEnCop(exportar, transitionBeanM.getId());

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String AssingContactC10True() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), true);

            copShared.InsertIntoContats(contactsBean);  //lo q hay desde el jsp

            transitionBeanM.setTime(copShared.GetTheDateTime());

            transitionBeanM.setContacts(true);

//        java.util.Date utilDate = new java.util.Date(); //se convierte de java.util.Date a java.sql.Date
//        utilDate= transitionBeanM.getTime();
//        java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());

            TransitionsBeanImp tbdate2 = new TransitionsBeanImp();
            Date date = new Date();
            DateFormat dateFormatCQL = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
            String fecha = dateFormatCQL.format(date);

            transitionBeanM.setContactsdate(fecha);

            copShared.UpdateContactsyContacsDateIntoTransitions(transitionBeanM);

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String DeletePersonAsContac11True() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            copBean = copShared.GetDataFromCop(transitionBeanM.getId(), exportar);

            ContactsBean contactsBeanId = new ContactsBean();
            contactsBeanId = copShared.GetDatosDeContacts(copBean.getId());

            copShared.DeleteContacto(contactsBeanId.getIdcop());

            copShared.ContarContactosEnTransitions(transitionBeanM.getId());

            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public String UploadtxtLogAlert06() {
        try {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared();
            CopShared copShared = new CopShared();
            CopBean copBean = new CopBean();
            ClienteStkBean clienteStkBean = new ClienteStkBean();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            ConexionFtp conexionFtp = new ConexionFtp(attach);
            File name = getFileNameUpload();
            String n = name.getPath();

            //Cambiar nombre
            String nombree = "";
            String path = "";

            for (int i = 0; i < getNombreArchivo().length(); i++) {
                if (String.valueOf(getNombreArchivo().charAt(i)).equalsIgnoreCase(".")) {
                    nombree += "_" + transitionBeanNew.getKnkey() + String.valueOf(getNombreArchivo().charAt(i));
                } else {
                    nombree += String.valueOf(getNombreArchivo().charAt(i));
                }
            }
            setNombreArchivo(nombree);


            //Cambiar path

            path = name.getParent() + "\\" + getNombreArchivo();
            File name2 = getFileNameUpload();

            //Renombrar nombre de archivo

            renombrar(path, getNombreArchivo());




            setS1("c:\\consultas.rar");
            //File firstLocalFile = new File("c:/consultas.rar");
            File firstLocalFile = new File(n);

            String firstRemoteFile = "consultas.rar";
            String nombre = firstLocalFile.getName();
            FileInputStream inputStream = new FileInputStream(name2);
            //FileInputStream inputStream = new FileInputStream(firstLocalFile);

            System.out.println("Start uploading first file");
            boolean done = conexionFtp.guarda(getNombreArchivo(), "attachments", inputStream);

            fileListOnServer = conexionFtp.enlistaDir(transitionBeanM.getKnkey());

            inputStream.close();
            if (done) {
                System.out.println("The first file is uploaded successfully.");
            }
            actualizarpagina(exportar);
        } catch (CstF2Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        } catch (Exception ex) {
            
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        if (exportar == false) {
            return SUCCESS;
        } else {
            return EXPORT;
        }
    }

    public static void renombrar(String rutaArchivo, String nuevoNombre) {

        //Creo un objeto File con la ruta dada
        File f1 = new File(rutaArchivo);
        //Evaluo si el archivo existe
        if (f1.exists()) {
            //Creo un objeto 2 para renombrar, tomando la ruta del directorio actual y el nuevo nombre
            //Con el que va a quedar el archivo
            File f2 = new File(f1.getParent() + nuevoNombre);
            //Evaluo si puede ser renombrado el archivo
            if (f1.renameTo(f2)) {
                System.out.println("Archivo " + f1.getAbsolutePath() + " se renombro exitosamente :^D");
            } else {
                System.out.println("Paila fallo el renombrado del archivo " + f1.getAbsolutePath() + " :-$");
            }
        } else {
            System.out.println("Changos! El archivo " + f1.getAbsolutePath() + " no existe :-$");
        }

        //Como pueden notar, aqui no se hizo uso de la excepcion FileNotFoundException, eso se
        //debe a que hago una evaluación previa de existencia con el fin de evitar Excepciones
    }

    public String addContact(){
    	CopContactsDto contact = new CopContactsDto();
    	contact.setCompany(company);
    	contact.setEmail(email);
    	contact.setExt(ext);
    	contact.setMobile(mobile);
    	contact.setName(name);
    	contact.setPhone(phone);
    	contact.setPosition(position);
    	contact.setIdCop(idImportExport);
    	
    	try {
			copService.addContact(contact);
			transitionService.insertHistorico(new HistoricoDto(this.getUsuario().getId(), new Date(),"Se agrego contacto a la BD", AccionesHistorico.AGREGAR_CONTACT));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	return SUCCESS;
    }
    
    
    public String addException(){
    	ExceptionCodeDto exception = new ExceptionCodeDto();
    	exception.setIdCop(idImportExport);
    	exception.setExceptionCode(exceptionCode);
    	exception.setExceptionLogic(exceptionLogic);
    	exception.setDescription(descriptionException);
    	try {
			copService.addExcetionCode(exception);
			transitionService.insertHistorico(new HistoricoDto(this.getUsuario().getId(), new Date(),"Se agrego nueva exception", AccionesHistorico.AGREGAR_EXCEPTION));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	return SUCCESS;
    }
    
    
    
    public String guardaFilesCop() throws Exception{
    	String ruta ="c:\\adjuntos";
    	File fileToCreate = null;
		if (this.getUpl() != null) {
			//
			String fileName = copService.getconsecutiveNameFile() + "_" + idImportExport + "_" +  uplFileName;
			fileToCreate = new File(ruta, fileName);
			FileUtils.copyFile(this.getUpl(), fileToCreate);
			
			//guada nombre  en bd
			CopAttachmentsDto attachment = new CopAttachmentsDto();
			attachment.setIdCop(idImportExport);
			attachment.setArchiveName(fileName);
			copService.saveNameAttachment(attachment);
			transitionService.insertHistorico(new HistoricoDto(this.getUsuario().getId(), new Date(),"Se agrego nuevo Attachment ", AccionesHistorico.AGREGAR_ATTACHMENT_COP));
		}

		return SUCCESS;
    }
    
    
    public String getListAttachment(){
    	
    	try {
    		CopAttachmentsDto attachment = new CopAttachmentsDto();
        	attachment.setIdCop(idImportExport);
			attachmentList = copService.getAttachmentName(attachment);
		} catch (SQLException e) {
			e.printStackTrace();
		}
    	return SUCCESS;
    }
    
    
	public String downloadFileCop(){
	       try {
	    	   String ruta ="c:\\adjuntos";
	           File file = new File(ruta+"\\"+this.getNameFileDownload());
	            	            
	            this.setInputStream(new FileInputStream(file));
	            try {
					transitionService.insertHistorico(new HistoricoDto(this.getUsuario().getId(), new Date(),"Se descargo attachment  "+getNameFileDownload() , AccionesHistorico.DOWNLOAD_ATTACHMENT_COP));
				} catch (SQLException e) {
					
					e.printStackTrace();
				}

	            if (this.getInputStream() == null) {
	                throw new CstF2Exception("No existe el archivo");
	            }

	        } catch (IOException ex) {
//	            java.util.logging.Logger.getLogger(TransitionClient.class.getName()).log(Level.SEVERE, null, ex);
	            addFieldError("Error al obtener el archivo", "Ocurrio un Error: error al descargar archivo. \n" + ex.getMessage());
	            return ERROR_DOWN;
	        } catch (CstF2Exception ex) {
	            
	            addFieldError("KnkeyIncorrecta", ex.getMessage());
	            return ERROR_DOWN;
	        }
	        return ZIP;
	}
	
	public String deleteContactCop() {
		CopContactsDto contact = new CopContactsDto();
		contact.setId(idContactDel);
		try {
			copService.deleteContactCop(contact);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		try {
			transitionService.insertHistorico(new HistoricoDto(this
					.getUsuario().getId(), new Date(),
					"Se elimino contact cop",
					AccionesHistorico.DELETE_CONTACT_COP));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return SUCCESS;
	}
	
	public String notifyStatusCop(){
		try {
//			mailService.sendNotifyStatusMail(cop.getTransition().getTransitionBeanM(), PlantillaNotifyStatus.NOTIFY_COP);
			mailService.sendNotifyContactsCop(mailService.getNotifyStatusCop(idImportExport));
			System.out.println();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	return SUCCESS;	
		
	}
	
	public String deleteFileCop(){
	    
 	   String ruta ="c:\\adjuntos";
        File file = new File(ruta+"\\"+this.getNameFileDownload());
        CopAttachmentsDto  attachment = new CopAttachmentsDto();	
        attachment.setId(idDeleteFileCop);
       
			try {
				 if (file.delete())
					 copService.deleteAttachment(attachment);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
//     	   System.out.println("El fichero ha sido borrado satisfactoriamente");

     return SUCCESS;
}
	
    
    public String cargaVistaImpoExpo(){
    	return SUCCESS;
    }
    
    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

	public UsuarioDto getUsuario() {
		return usuario;
	}

	public void setUsuario(UsuarioDto usuario) {
		this.usuario = usuario;
	}

	public Cop getCop() {
		return cop;
	}

	public void setCop(Cop cop) {
		this.cop = cop;
	}

	public String getSbp() {
		return sbp;
	}

	public void setSbp(String sbp) {
		subproducts.setOverview(sbp);
		this.sbp = sbp;
	}

	public boolean isSubFcl() {
		return subFcl;
	}

	public void setSubFcl(boolean subFcl) {
		subproducts.setFcl(subFcl);
		this.subFcl = subFcl;
	}

	public boolean isSubLcl() {
		return subLcl;
	}

	public void setSubLcl(boolean subLcl) {
		subproducts.setLcl(subLcl);
		this.subLcl = subLcl;
	}

	public boolean isSubPerishables() {
		return subPerishables;
	}

	public void setSubPerishables(boolean subPerishables) {
		subproducts.setPerishables(subPerishables);
		this.subPerishables = subPerishables;
	}

	public boolean isSubBrokerage() {
		return subBrokerage;
	}

	public void setSubBrokerage(boolean subBrokerage) {
		subproducts.setBrokerage(subBrokerage);
		this.subBrokerage = subBrokerage;
	}

	public boolean isSubIntermodal() {
		return subIntermodal;
	}

	public void setSubIntermodal(boolean subIntermodal) {
		subproducts.setIntermodal(subIntermodal);
		this.subIntermodal = subIntermodal;
	}

	public boolean isSubInsurance() {
		return subInsurance;
	}

	public void setSubInsurance(boolean subInsurance) {
		
		subproducts.setInsurance(subInsurance);
		this.subInsurance = subInsurance;
	}

	public void setImports(List<CopDto> imports) {
		this.imports = imports;
	}

	public List<CopDto> getImports() {
		return imports;
	}

	public List<CopDto> getExports() {
		return exports;
	}

	public void setExports(List<CopDto> exports) {
		this.exports = exports;
	}

	public Integer getIdImportExport() {
		return idImportExport;
	}

	public void setIdImportExport(Integer idImportExport) {
		this.idImportExport = idImportExport;
	}

	public List<CopContactsDto> getContactsCop() {
		return contactsCop;
	}

	public void setContactsCop(List<CopContactsDto> contactsCop) {
		this.contactsCop = contactsCop;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getExt() {
		return ext;
	}

	public void setExt(String ext) {
		this.ext = ext;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getExceptionCode() {
		return exceptionCode;
	}

	public void setExceptionCode(String exceptionCode) {
		this.exceptionCode = exceptionCode;
	}

	public String getExceptionLogic() {
		return exceptionLogic;
	}

	public void setExceptionLogic(String exceptionLogic) {
		this.exceptionLogic = exceptionLogic;
	}

	public String getDescriptionException() {
		return descriptionException;
	}

	public void setDescriptionException(String descriptionException) {
		this.descriptionException = descriptionException;
	}

	public List<ExceptionCodeDto> getExceptions() {
		return exceptions;
	}

	public void setExceptions(List<ExceptionCodeDto> exceptions) {
		this.exceptions = exceptions;
	}

	public File getUpl() {
		return upl;
	}

	public void setUpl(File upl) {
		this.upl = upl;
	}

	public String getUplFileName() {
		return uplFileName;
	}

	public void setUplFileName(String uplFileName) {
		this.uplFileName = uplFileName;
	}

	public List<CopAttachmentsDto> getAttachmentList() {
		return attachmentList;
	}

	public void setAttachmentList(List<CopAttachmentsDto> attachmentList) {
		this.attachmentList = attachmentList;
	}

	public String getNameFileDownload() {
		return nameFileDownload;
	}

	public void setNameFileDownload(String nameFileDownload) {
		this.nameFileDownload = nameFileDownload;
	}

	public InputStream getInputStream() {
		return inputStream;
	}

	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}

	public int getIdDeleteFileCop() {
		return idDeleteFileCop;
	}

	public void setIdDeleteFileCop(int idDeleteFileCop) {
		this.idDeleteFileCop = idDeleteFileCop;
	}

	public int getIdContactDel() {
		return idContactDel;
	}

	public void setIdContactDel(int idContactDel) {
		this.idContactDel = idContactDel;
	}
	
	
	
	
	
	
	
    
}
